package com.ct.gd.passport.util;

import android.app.Application;
import android.content.Context;
import android.telephony.TelephonyManager;

public class TelephonyState {

	private static final TelephonyState instance = new TelephonyState();
	private boolean bInit;
	private TelephonyManager tm;
	
	private TelephonyState(){
	}
	
	public static final TelephonyState getInstance(){
		return instance;
	}
	
	public void init(Application app){
		tm = (TelephonyManager)app.getSystemService(Context.TELEPHONY_SERVICE);
		bInit = true;
	}
	
	public String getIMEI(){
		if(!bInit){
			return null;
		}else{
			return tm.getDeviceId();
		}
	}
	
	public String getPhoneNumber(){
		if(!bInit){
			return null;
		}else{
			return tm.getLine1Number();
		}
	}
}
